<template>
    <div>
        <el-button type="primary" style="margin-bottom:10px;margin-top:10px" @click="backhome()">返回主页</el-button>
        <el-card>
          <el-input placeholder="请输入订单租用设施类型/设施编号/处理状态/完成状态查询用户" v-model="selectinput" class="input-with-select" clearable @clear="getOrder()">
            <el-button slot="append" icon="el-icon-search" @click="selectuser()"></el-button>
          </el-input>
            <el-table :data="orderlist" stripe style="width: 100%" border>
                <el-table-column prop="ordernumber" label="订单号" width="65"> </el-table-column>
                <el-table-column prop="ordertime" label="下单时间" width="180"> </el-table-column>
                <el-table-column prop="orderynumber" label="预留手机号" width="115"> </el-table-column>
                <el-table-column prop="orderusetimestart" label="使用开始时间" width="180"> </el-table-column>
                <el-table-column prop="orderusetimeend" label="使用结束时间" width="180"> </el-table-column>
                <el-table-column prop="orderunit" label="租用管理单位编号" width="135"> </el-table-column>
                <el-table-column prop="orderfacilities" label="租用设施类型" width="110"> </el-table-column>
                <el-table-column prop="ordervenue" label="租用设施编号" width="170"> </el-table-column>
                <el-table-column prop="daorderstatuste" label="处理状态" width="90"> </el-table-column>
                <el-table-column prop="ordermoney" label="订单金额" width="80"> </el-table-column>
                <el-table-column prop="state" label="完成状态" width="80"> </el-table-column>
            </el-table>
            <el-pagination
              @size-change="handleSizeChange1"
              @current-change="handleCurrentChange1"
              :current-page="this.pagenum1"
              :page-sizes="[5, 10, 20, 50]"
              :page-size="this.pagesize1"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total">
            </el-pagination>
        </el-card>
    </div>
</template>

<script>
export default {
    data() {
        return {
            orderlist:[],
            userlist:[],
            // 当前的页数
            pagenum:1,
            // 当前每页显示多少条数据
            pagesize:10,
            // 普通用户等级
            query:'',

            total: 0,

            selectinput:'',
        }
    },
    created() {
        this.getOrder()
    },
    methods: {

        // //获取当前登录用户信息
        // getusers() {
        //     this.getRequest('/user/info').then(resp => {
        //         this.userlist=resp
        //         this.query=this.userlist.userid
        //         // console.log(this.query)
        //     })
        // },

        //根据用户身份证号获取订单
        getOrder() {
            this.getRequest('/user/info').then(resp => {
                // this.userlist=resp
                this.query=resp.userid
                if (this.query==null) {
                    this.$message.console.error('无订单');
                }
                this.getRequest('/order/orders/?pagenum='+this.pagenum+'&pagesize='+this.pagesize+'&query='+this.query).then(resp => {
                this.orderlist=resp.data.current_data
                this.total=resp.data.total
                })
            })
        },

        //根据条件查询订单
        selectuser() {
            this.getRequest('/order/orders/?pagenum='+this.pagenum+'&pagesize='+this.pagesize+'&query='+this.selectinput).then(resp => {
                this.orderlist=resp.data.current_data
                this.total=resp.data.total
            })
        },

        //返回主页
      backhome() {
        this.$router.replace('/puser')
      }
    }
}
</script>

<style lang="less" scoped>
.input-with-select {
    width: 50%;
}
</style>>
